package com.example.biz;

import com.example.client.HelloWorld;
import com.rpc.provider.RPCProvider;
import com.rpc.provider.configer.PublishConfiger;

public class HelloWorldImpl implements HelloWorld {
    @Override
    public String sayHello(String name) {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Hello" + name + "!";
    }

    public static void main(String[] args) {
        RPCProvider rpcProvider = new RPCProvider();
        rpcProvider.setVersion("1.0.0");
        HelloWorld helloWorld = new HelloWorldImpl();
        rpcProvider.setTarget(helloWorld);
        rpcProvider.setServerInterface(HelloWorld.class.getCanonicalName());
        PublishConfiger configer=new PublishConfiger("publisherConfigure.properties");
        rpcProvider.publish(configer);
    }
}
